Skip to content

feat: oss index categories endpoint - #2351

Merged
epipav merged 5 commits into
mainfrom
feat/IN-1415
Oct 14, 2026
Merged

epipav merged 5 commits into
mainfrom
feat/IN-1415

Conversation

@epipav

@epipav epipav commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds GET /v1-alpha/oss-index/categories (IN-1415, epic IN-1146). It returns one category group's details and its categories, each with its top collections and top projects.

  • categoryGroupSlug picks the group and is required. sort (totalContributors or softwareValue, default totalContributors) orders the categories.
  • The route reads the group from category_groups_list first. An unknown slug answers 404 not_found, and the categories pipe is then skipped.
  • Categories come from categories_oss_index, with tuples mapped through the shared module from the groups endpoint.
  • A malformed row from either pipe answers 503 upstream_unavailable.

Notes

  • This pipe's project tuples carry 12 slots without status, so src/lib/oss-index.ts gains CategoryTopProject and its guard and mapper. Both project guards share the leading slots and the v2 health tail. The groups route's shape is unchanged.
  • The response is { name, slug, type, categories }, a single group with its child list.
  • Stacked on feat: oss index groups endpoint #2350.

Tests

  • tests/oss-index-categories.test.ts: both pipe calls and their params, 404 for an unknown slug, 400 for a missing slug or an invalid sort, tuple mapping, 503 for malformed rows, empty categories, and the OpenAPI entry.
  • tests/oss-index.test.ts: the 12-slot guard and mapper.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 13:09
@cursor

cursor Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Read-only v1-alpha endpoint following the existing OSS Index groups pattern, with strict upstream validation and no changes to auth or existing group responses.

Overview
Adds GET /v1-alpha/oss-index/categories, which returns one OSS Index category group (by required categoryGroupSlug) and its categories with totals, top collections, and top projects. Optional sort (totalContributors or softwareValue) is passed to Tinybird as orderBy.

The handler loads the group from category_groups_list first; an unknown slug returns 404 and skips the categories pipe. Categories come from categories_oss_index, with row/tuple validation and 503 on malformed upstream data.

oss-index.ts is refactored so project tuple guards share ProjectHead and HealthTail, and adds CategoryTopProject / CategoryTopProjectTuple for the categories pipe’s 12-slot project tuples (no status slot). Existing group TopProject mapping is unchanged in shape.

Tests cover the new route (pipes, mapping, 400/404/503, OpenAPI) and unit tests for the category tuple guard and mapper.

Reviewed by Cursor Bugbot for commit 3b61d7c. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation matches the described contract and includes comprehensive validation and test coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Adds the /v1-alpha/oss-index/categories endpoint for retrieving a category group and its categories.

Changes:

  • Adds validated Tinybird queries and response schemas.
  • Adds 8-slot project tuple mapping.
  • Adds comprehensive endpoint and mapper tests.
File Description
api/​src/​versions/​v1-alpha/​oss-index/​categories.ts Implements the endpoint.
api/​src/​lib/​oss-index.ts Adds category project guards, schema, and mapper.
api/​tests/​oss-index-categories.test.ts Tests endpoint behavior and validation.
api/​tests/​oss-index.test.ts Tests tuple mapping and guards.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 13:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Score guards permit values outside the ranges promised by the API contract.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Comment thread api/src/versions/v1-alpha/oss-index/categories.ts Outdated

@gaspergrom gaspergrom left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The 8-slot guard composes cleanly into the 9-slot one, and the tests cover the 404 short-circuit and the malformed-row 503 paths.

@themarolt themarolt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@epipav
epipav added this pull request to stack #2380 October 14, 2026 11:23
Copilot AI balanced review requested due to automatic review settings October 14, 2026 11:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The tuple guard rejects the current 12-slot categories pipe output, causing valid requests to return 503.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread api/src/lib/oss-index.ts Outdated

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread api/src/lib/oss-index.ts
Copilot AI balanced review requested due to automatic review settings October 14, 2026 12:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation matches the described contract and has comprehensive focused coverage.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 14, 2026 12:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation matches the stated contract and has comprehensive validation and integration coverage.

0 open findings

🧠 Review effort: Balanced

@epipav

epipav commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 13:13
@epipav

epipav commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The endpoint, validation, mapping, error handling, and tests are complete and consistent with adjacent OSS Index routes.

0 open findings

🧠 Review effort: Balanced

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bb8e59d. Configure here.

Base automatically changed from feat/IN-1414 to main October 14, 2026 15:14
Signed-off-by: anilb <epipav@gmail.com>
Signed-off-by: anilb <epipav@gmail.com>
Signed-off-by: anilb <epipav@gmail.com>
Signed-off-by: anilb <epipav@gmail.com>
Signed-off-by: anilb <epipav@gmail.com>
@epipav
epipav merged commit b2ebc49 into main Oct 14, 2026
12 checks passed
@epipav
epipav deleted the feat/IN-1415 branch October 14, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants